﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WEBWeixinSDK
{
    public class SysLog
    {

        public event EventHandler<CQLogEventArgs> NewLogWrite = null;
        private List<string> logMessages = null;
        private static SysLog _instance = null;
        private SysLog()
        {
            this.logMessages = new List<string>();
        }

        public static SysLog GetInstance()
        {
            if (_instance == null)
            {
                _instance = new SysLog();
            }

            return _instance;
        }

        public void AddLog(string message)
        {

            if (this.NewLogWrite != null)
            {
                this.NewLogWrite(this, new CQLogEventArgs() { LogMessage = message });
            }
        }


    }
    public class CQLogEventArgs : EventArgs
    {
        /// <summary>
        /// 日志发生的时间。
        /// </summary>
        public DateTime LogTime
        {
            get;
            set;
        }

        /// <summary>
        /// 日志来源。
        /// </summary>
        public string LogSource
        {
            get;
            set;
        }

        /// <summary>
        /// 日志类型。
        /// </summary>
        public string LogType
        {
            get;
            set;
        }

        /// <summary>
        /// 日志信息。
        /// </summary>
        public string LogMessage
        {
            get;
            set;
        }
        /// <summary>
        /// 私聊信息。
        /// </summary>
        public string Message
        {
            get;
            set;
        }
    }
}
